  ADDIX
 -------

A game for the Commodore 64, Vic20, Plus4/C16, PET40/80, ZX Spectrum and DOS.

Addix is a classic 2 player game, you against the computer.
You select a number from the current row, using SPACE then ENTER to move.
The number you select is added to your score.
The Computer replies by selecting a number from the column of your 
last move. When a side no longer has a move left, the side with the
highest score wins.

COMMANDS:
   SPACE : Select a move.
   ENTER : Make a move.
   N : Start a new game.
   G : Make Computer take your move, swapping sides.
   I : Set Computer search depth. (1-9)
   T : Toggle 2 player mode, Human vs Human.
   F : Toggle board frame off/on.
   H : Show Help screen.
   Z : Start a new game, with the same layout. (N for next layout)
   A : Autoplay, Computer vs Computer.
   W,E : Resize board, from 4x4 to 10x10.
   ESC  : Quit to OS.

The scores are shown at the top:
"H:XXX V:XXX" H=Horizontal player (normally Human), V=Vertical Player. 

You play normally takes the Horzontal row of numbers, with the computer
replying taking from the vertical column of numbers. 
If you hit 'G' the computer takes your turn, and you swap sides, 
with you taking the Vertical numbers.

The IQ search level is normally restricted to the range 1-9,
wrapping back to 1 when you go past 9.
This is the number of moves to look ahead, so if you set IQ=1
the computer just selects the highest number in the column.
To search deeper, you can set 2 player mode then the IQ can be set as
high as you want. But remember, searches can become very slow
when you do this, which is why it is normally restricted. 

Note that the Z command allows you to start a new game with the same
layout, by resetting the Random generator. You can then hit N to get
more "fixed" game layouts, so you can play the same game
and try different moves. It is also useful for testing and benchmarks,
since the same depth of Computer search should produce the same node
count for the same position.


   ADDIX CODE DETAILS
  --------------------

Addix uses the classic AlphaBeta search recursive algorithm, in this form:

int AlphaBeta (int depth, int alpha, int beta)
{
    if (depth == 0)
        return Evaluate();
    GenerateLegalMoves();
    while (MovesLeft()) {
        MakeNextMove();
        val = -AlphaBeta(depth - 1, -beta, -alpha);
        UnmakeMove();
        if (val >= beta)
            return beta;
        if (val > alpha)
            alpha = val;
    }
    return alpha;

If the move list is sorted before search, you will get even deeper/faster
searches, but that requires more storage and code, I wanted to keep it small
so that it builds on a 5k VIC20. As it is, it can beat most players.

Addix is a working example for the "Very Tiny Development Layer" (VTDL)
portable library. This is a library specifically designed to be efficient
with very small target systems, for example Addix runs on an
unexpanded 5K VIC20.
It will eventually target many systems, from Vic20s up to PCs.

The source code is included, "addix.c", and the VTDL library in 
folder "tdl". Some compiler build scripts are also included.
The 6502 targets can be build with the OSCAR64 C compiler, which
is good for these small systems. 
For example to build for C64, Vic20 and PET install OSCAR64, then 
from the work dir type:

 tdl/tdlmakosc.sh addix/addix -Os

For more details, see "vtdl.txt" in the tdl folder.

I first wrote the program as "Addle" on the PET.
A version appeared on Feb 1988 PC+ Magazine Cover Disk. 

-----------------------------------------------------------------------------
ADDIX - (C) A.Millett 1981-2026.
Released as free/open software under GNU GPL3 license. 
  See: www.gnu.org/licenses/gpl-3.0.html
For updates and more programs see:     www.github.com/orac81
-----------------------------------------------------------------------------
